package com.example.administrator.myapplication.Presenter;

import com.example.administrator.myapplication.Bean.Picture;
import com.example.administrator.myapplication.Model.IPictureModel;
import com.example.administrator.myapplication.Model.PictureModel;
import com.example.administrator.myapplication.View.Fragment.IPictureView;

/**
 * Created by Administrator on 2019/10/14 0014.
 */

public class PicturePersenter implements IPicturePresenter,IPictureListener{
    private IPictureModel iPictureModel;
    private IPictureView iPictureView;

    public PicturePersenter(IPictureView pictureView) {
        this.iPictureModel = new PictureModel();
        this.iPictureView = pictureView;
    }

    @Override
    public void getRandomPicture() {
        iPictureModel.getRamdomPicture(this);
    }

    @Override
    public void success(Picture picture) {
        iPictureView.showPicture(picture);
    }

    @Override
    public void error(String msg) {
        iPictureView.showError(msg);
    }
}
